/*
 * Copyright 2018 JDCLOUD.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * OpenAPI spec version: 1.0
 * 
 *
 * NOTE: This class is auto generated by the jdcloud code generator program.
 */

package net.jdcloud.HufuDatacubeService.model.transform;

import javax.xml.bind.JAXBException;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.Feature;
import com.jdcloud.sdk.apim.JdcloudSdkException;
import com.jdcloud.sdk.apim.http.ContentType;
import com.jdcloud.sdk.apim.service.JdcloudUnmarshaller;
import com.jdcloud.sdk.apim.utils.ConvertUtils;
import net.jdcloud.HufuDatacubeService.model.ModelAnalysisPOSTResponse;

public class ModelAnalysisPOSTResponseUnmarshaller implements JdcloudUnmarshaller {

    public final static Feature[] FEATURES = { Feature.AutoCloseSource, Feature.UseBigDecimal,
            Feature.AllowUnQuotedFieldNames, Feature.AllowSingleQuotes, Feature.AllowArbitraryCommas,
            Feature.AllowArbitraryCommas, Feature.SortFeidFastMatch, Feature.IgnoreNotMatch };

    public ModelAnalysisPOSTResponse unmarshall(String content, ContentType contentType) {
        ModelAnalysisPOSTResponse modelAnalysisPOSTResponse = new ModelAnalysisPOSTResponse();
        if(contentType == ContentType.APPLICATION_XML || contentType == ContentType.TEXT_XML) {

            try {
                modelAnalysisPOSTResponse.setResult(content);
            } catch (Exception e) {
                throw new JdcloudSdkException(e);
            }

        } else {
            modelAnalysisPOSTResponse.setResult(content);}
        return modelAnalysisPOSTResponse;
    }

    private static ModelAnalysisPOSTResponseUnmarshaller instance;

    public static ModelAnalysisPOSTResponseUnmarshaller getInstance() {
        if (instance == null)
            instance = new ModelAnalysisPOSTResponseUnmarshaller();
        return instance;
    }
}